/*
*************************************
* PocketGTT
*************************************
This file is part of PocketGTT.

PocketGTT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PocketGTT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PocketGTT.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

Rectangle {
    //    width: 360
    //    height: 360

    // set size to screen
    anchors.fill: parent
    anchors.centerIn: parent
    id: aboutview
    state: "active"

    color: myWin.theme.aboutview_background

    MouseArea {
        anchors.fill: parent
        onClicked: {
            //myWin.statesMan.aboutview_active = !myWin.statesMan.aboutview_active
            myWin.statesMan.aboutview_active = false
        }
    }

    Flipable {
        id: flipable
        width: parent.width
//        height: 240
        anchors.top: parent.top
        anchors.bottom: ctrlTextBox.top
//        anchors.bottomMargin: 20
        anchors.margins: 20

        property bool flipped: false

        front: AboutViewIntro { }
        back: AboutViewInstructions { }

        transform: Rotation {
            id: rotation
            origin.x: flipable.width/2
            origin.y: flipable.height/2
            axis.x: 0; axis.y: 1; axis.z: 0     // set axis.y to 1 to rotate around y-axis
            angle: 0    // the default angle
        }

        states: State {
            name: "back"
            PropertyChanges { target: rotation; angle: 180 }
            when: flipable.flipped
        }

        transitions: Transition {
            NumberAnimation { target: rotation; property: "angle"; duration: myWin.theme.changetimeM }
        }

    }



    Rectangle {
        id: ctrlTextBox
        height: ctrlText.height + 20
        width: ctrlText.width + 25
        color: "transparent"
        border.width: 2
        border.color: "white"
        radius: ctrlTextBox.height / 4
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 12
        anchors.horizontalCenter: parent.horizontalCenter

        Text {
            id: ctrlText
            text: qsTr("Visualizza le istruzioni")
            anchors.centerIn: parent
            color: "white"
            font.pixelSize: myWin.theme.textSizeM   //26
            wrapMode: Text.Wrap

        }
        MouseArea {
            anchors.fill: parent
            onClicked: {
                if (flipable.flipped) {
                    flipable.flipped = false;
                    ctrlText.text = qsTr("Visualizza le istruzioni")
                }
                else {
                    flipable.flipped = true;
                    ctrlText.text = qsTr("Informazioni sul programma")
                }
            }
        }

    }


    states: [
        State {
            name: "active"
            when: myWin.statesMan.aboutview_active
            PropertyChanges { target: aboutview; opacity: 1}
        },
        State {
            name: "hidden"
            when: !myWin.statesMan.aboutview_active
            PropertyChanges { target: aboutview; opacity: 0}
        }
    ]
    transitions: [
        Transition {
            NumberAnimation { properties: "opacity"; duration: myWin.theme.changetimeM}
        }
    ]
}
